<template>
<!-- 悬浮按钮 开始 -->
  <div class="fixed_button">
    <div class="fixed_box">
      <!-- <div class="fixed_tips" v-if="$slots.tips"> -->
      <slot name="tips" />
      <!-- </div> -->
      <div class="inner">
        <div class="left">
          <div class="home" @click="goHome">
            <img src="@/assets/images/home.png" class="img" alt="">
            <span>首页</span>
          </div>
          <div class="home" @click="goService">
            <img src="@/assets/images/zixun.png" class="img" alt="">
            <span>在线咨询</span>
          </div>
        </div>
        <div class="right">
          <slot name="right"></slot>
          <button class="btn" @click="goBook" v-if="!$slots.right">免费预约</button>
        </div>
      </div>
    </div>
</div>
<!-- 悬浮按钮 end -->
</template>
<script>
import { GET_SERVICE_PATH } from '@/http/interface'
export default {
  name: "FixedMenu",
  props: {
    source: {
      type: String,
      default: "",
    },
    id: {
      type: [String, Number],
      default: "",
    },
    click: {
      type: Function
    },
    hospitalId: {
      type: [String, Number],
      default: ''
    }
  },
  data() {
    return {};
  },
  methods: {
    // 去预约
    goBook() {
      console.log(this.click)
      if (this.click) {
        this.click()
        return false;
      }
      this.$router.push({
        path: "/hospital/book",
        query: { source: this.source, id: this.id, hospitalId: this.hospitalId },
      });
    },

    // 回首页
    goHome() {
      this.$router.push({
        path: '/home'
      })
    },

    // 在线咨询
    goService() {
      window.location.href = GET_SERVICE_PATH
    }

  },
};
</script>
<style lang="less" scoped>@import "./index.less";</style>